import { AiOutlineFieldNumber } from 'react-icons/ai';
import { DataType } from './data-types.define';

export const NumberDataType: DataType<number> = {
  name: 'number',
  icon: AiOutlineFieldNumber,
  examples: {
    short: 1,
    medium: 10_000,
    long: 1_000_000_000,
  },
  variants: [
    'SMALLINT',
    'INTEGER',
    'BIGINT',
    'NUMERIC',
    'DECIMAL',
    'FLOAT',
    'REAL',
    'DOUBLE',
    'PRECISION',
    'tinyint',
    'int',
    'UNSIGNED',
    'BIG',
    'INT',
    'INT2',
    'INT8',
    'UNSIGNED SMALL',
    'money',
    'smallmoney',
    'datetimeoffset',
    'INT4',
    'DOUBLE PRECISION',
    'FLOAT8',
    'SMALLSERIAL',
    'SERIAL2',
    'SERIAL',
    'SERIAL4',
    'BIGSERIAL',
    'SERIAL8',
    'MEDIUMINT',
    'DEC',
    'BIT',
  ],
  validationFuction: Number.isNaN,
  formatter: (value) => Number(value).valueOf(),
};
